<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    
    
    <title>修改密码</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<script type="text/javascript" src="../js/jquery-1.4.2.js"></script>
 <script type="text/javascript">
   function checkPw(){
    var oldPw = $("#oldPw").val();
    var newPw = $("#newPw").val();
     if(oldPw.length==0){
     alert("请输入原密码！");
      $("#old").focus();
        return false;
     }
     if(newPw.length==0){
     alert("请输入新密码！");
     $("#new").focus();
        return false;
     }
     $.ajax({
      url:'<%=basePath%>/member/findPw.shtml',
      data:"password="+$("#oldPw").val()+"&newPw="+$("#newPw").val(),
      method:"post",
      cache:false,
      success:function (msg){
               var obj=eval('('+msg+')');
               var result=obj["result"];
                     if(!result){
                         alert("原密码不正确！");
                         return;
                     }
                       if(result){
                         alert("密码修改成功！");
                         window.parent.location.href="<%=basePath %>back/index.html";
                      }     
        }
     });
   }
 
 </script>
  </head>
  
  <body>
  <form>
  <table align="center">
  <tr>
  <td colspan="2" align="center">修改密码</td>
  </tr>
  <tr>
  <td>原密码：</td>
  <td><input type="text" id="oldPw"></td>
  </tr>
  <tr>
  <td>新密码：</td>
  <td><input type="text" id="newPw"></td>
  </tr>
  <tr>
  <td align="center" colspan="2"><input type="button"  onclick ="checkPw()" value="确定"><input type="button" value="取消"></td>
  </tr>
  </table>
  </form>
  </body>
</html>
